package com.lagou.sqlSession;

import com.lagou.pojo.Configuration;
import com.lagou.pojo.MapStatement;

import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author jsy
 * @description: TODO
 * @date 2021/8/28 20:19
 */
public interface Executor {
    /**
     * 查询操作
     *
     * @param configuration
     * @param mapStatement
     * @param param
     * @param <E>
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     * @throws InstantiationException
     * @throws IntrospectionException
     * @throws InvocationTargetException
     */
    <E> List<E> query(Configuration configuration, MapStatement mapStatement, Object... param) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException, InstantiationException, IntrospectionException, InvocationTargetException;

    /**
     * 删除，更新，添加。对数据进行操作
     *
     * @param configuration
     * @param mapStatement
     * @param param
     * @return
     * @throws SQLException
     * @throws ClassNotFoundException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     */
    int executeQuery(Configuration configuration, MapStatement mapStatement, Object... param) throws SQLException, ClassNotFoundException, NoSuchFieldException, IllegalAccessException;
}
